<div class="middle">
  <div class="middle-header header-toolbar">
    <div class="container-fluid">
      <div class="page-header page-header-bleed-right page-header-bleed-left">
        <div class="pull-right" ng-if="project && (persistentVolumeClaimsVersion | canI : 'create') && ((pvcs | hashSize) > 0 || filterWithZeroResults)">
          <a ng-if="!outOfClaims" ng-href="project/{{project.metadata.name}}/create-pvc" class="btn btn-default">Create Storage</a>
          <a ng-if="outOfClaims" href="" class="btn btn-default disabled" aria-disabled="true">Create Storage</a>
        </div>
        <h1>
          Storage
          <span class="page-header-link">
            <a ng-href="{{'storage' | helpLink}}" target="_blank">
              Learn More <i class="fa fa-external-link" aria-hidden="true"></i>
            </a>
          </span>
        </h1>
      </div>
      <div ng-if="(pvcs | hashSize) > 0 || filterWithZeroResults" class="data-toolbar">
        <div class="data-toolbar-filter">
          <project-filter></project-filter>
        </div>
      </div>
    </div>
  </div><!-- /middle-header-->
  <div class="middle-content">
    <div class="container-fluid">
      <alerts alerts="alerts"></alerts>
      <div class="row">
        <div class="col-md-12">
          <div ng-if="(pvcs | hashSize) === 0">
            <p ng-if="!pvcsLoaded">
              Loading...
            </p>
            <div ng-if="pvcsLoaded" class="empty-state-message text-center">
              <div ng-if="!filterWithZeroResults">
                <h2>No persistent volume claims.</h2>
                <p>
                  No persistent volume claims have been added to project {{projectName}}.
                </p>
                <p ng-if="project && (persistentVolumeClaimsVersion | canI : 'create') && !filterWithZeroResults">
                  <a ng-if="!outOfClaims" ng-href="project/{{project.metadata.name}}/create-pvc" class="btn btn-primary">Create Storage</a>
                  <a ng-if="outOfClaims" href="" class="btn btn-primary disabled" aria-disabled="true">Create Storage</a>
                </p>
              </div>
              <div ng-if="filterWithZeroResults">
                <h2>The filter is hiding all persistent volume claims. <button type="button" class="btn btn-link inline-btn-link" ng-click="clearFilter()">Clear All Filters</button></h2>
              </div>
            </div>
          </div>
          <table ng-if="(pvcs | hashSize) > 0" class="table table-bordered table-mobile table-layout-fixed">
            <colgroup>
              <col class="col-sm-5">
            </colgroup>
            <thead>
              <tr>
                <th>Name</th>
                <th>Status</th>
                <th>Capacity</th>
                <th>Access Modes</th>
                <th>Age</th>
              </tr>
            </thead>
            <tbody>
              <tr ng-repeat="pvc in pvcs | orderObjectsByDate : true">
                <td data-title="Name"><a ng-href="{{pvc | navigateResourceURL}}">{{pvc.metadata.name}}</a>
                  <span ng-if="pvc | storageClass" class="text-muted"> using storage class {{pvc | storageClass}}</span>
                </td>
                <td data-title="Status">
                  <status-icon status="pvc.status.phase" disable-animation></status-icon>
                  {{pvc.status.phase}}
                  <span ng-if="pvc.spec.volumeName">to volume <strong>{{pvc.spec.volumeName}}</strong></span>
                </td>
                <td data-title="Capacity">
                  <span ng-if="pvc.spec.volumeName">
                    <span ng-if="pvc.status.capacity['storage']">{{pvc.status.capacity['storage'] | usageWithUnits: 'storage'}}</span>
                    <span ng-if="!pvc.status.capacity['storage']">unknown</span>
                  </span>
                  <span ng-if="!pvc.spec.volumeName">
                    <span>-</span>
                  </span>
                </td>
                <td data-title="Access Modes">{{pvc.spec.accessModes | accessModes:'long' | join}}</td>
                <td data-title="Age"><span am-time-ago="pvc.metadata.creationTimestamp" am-without-suffix="true"></span></td>
              </tr>
            </tbody>
          </table>
        </div><!-- /col-* -->
      </div>
    </div>
  </div><!-- /middle-content -->
</div>
